import {
  Body,
  Controller,
  Delete,
  Get,
  Param,
  Patch,
  Post,
} from '@nestjs/common';
import { WeaponService } from './weapon.service';
import { CreateWeaponDto } from './dto/create-weapon.dto';
import { UpdateWeaponDto } from './dto/update-weapon.dto';
import { PageQuery } from '../../../util/entity/page.entity';
import { Weapon } from './entities/weapon.entity';

@Controller()
export class WeaponController {
  constructor(private readonly weaponService: WeaponService) {}

  @Post()
  create(@Body() createWeaponDto: CreateWeaponDto) {
    return this.weaponService.create(createWeaponDto);
  }

  @Post('list')
  findAll(@Body() pageQuery: PageQuery<Weapon>) {
    return this.weaponService.findAll(pageQuery);
  }

  @Get(':id')
  findOne(@Param('id') id: number) {
    return this.weaponService.findOne(id);
  }

  @Patch(':id')
  update(@Param('id') id: number, @Body() updateWeaponDto: UpdateWeaponDto) {
    return this.weaponService.update(id, updateWeaponDto);
  }

  @Delete(':id')
  remove(@Param('id') id: number) {
    return this.weaponService.remove(id);
  }
}
